<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增小区投诉建议信息')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-complaint-add">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">投诉人：</label>
                    <div class="col-sm-8">
                        <select name="residentId" id="residentId" class="form-control" required>
                            <!-- 分类选项将通过 JavaScript 动态填充 -->
                            <option th:each="resident:${residents}" th:value="${resident.id}" th:text="${resident.name}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">投诉建议内容：</label>
                    <div class="col-sm-8">
                        <textarea name="description" class="form-control" required></textarea>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">提交时间：</label>
                    <div class="col-sm-8">
                        <div class="input-group date">
                            <input name="submitTime" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">投诉类别</label>
                    <div class="col-sm-8">
                        <select name="handleStatusId" id="handleStatusId" class="form-control" required>
                            <!-- 分类选项将通过 JavaScript 动态填充 -->
                            <option th:value="1">小区环境</option>
                            <option th:value="2">物业服务</option>
                            <option th:value="3">楼层漏雨</option>
                            <option th:value="4">吵闹</option>
                            <option th:value="5">其他</option>
                        </select>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/complaint"
        $("#form-complaint-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-complaint-add').serialize());
            }
        }

        $("input[name='submitTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>